// index.js
import request from '../../utils/request'

const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'




Page({
  data: {
    imgUrls: [
      { url: '../../img/index/article17.jpg', link: '/pages/index/index' },
      { url: '../../img/index/article17.jpg', link: '/pages/logs/logs' },
      { url: '../../img/index/article17.jpg', link: '/pages/detail/detail' }
    ],
    autoplay: true,
    interval: 3000,
    duration: 500,
    img_six:[
      {url:'../../img/index/@2x_ceping.png',name:'测评',path:'/pages/index/ceping/ceping'},
      {url:'../../img/index/@2x_yuyue.png',name:'预约',path:'/pages/talk/consultyy/consultyy'},
      {url:'../../img/index/@2x_dayi.png',name:'答疑',path:'/pages/index/dayi/dayi'},
      {url:'../../img/index/@2x_zhishi.png',name:'知识',path:'/pages/xinlizhishi/xinlizhishi'},
      {url:'../../img/index/@2x_FM.png',name:'FM',path:'/pages/fm_home/fm_home'},
      {url:'../../img/index/@2x_gongyi.png',name:'公益',path:'/pages/gongyezhongxin/gongyezhongxin'}
    ],
    items: [],
  },
  async onLoad(options) {
    const res = await request.get("/dmy/featuredArticle/findAll",
    {
      id:-1,
      pageNum: 1,
      pageSize: 3
    }
)
  console.log(res.data.list)

    // const sampleData = [
    //   {
    //     image: "/img/index/文章2.png", // 替换为实际图片路径
    //     label1: "\"公益捐步\"属于公开募捐吗？",
    //     label2: "\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？"
    //   },
    //   {
    //     image: "/img/index/文章1.png", // 替换为实际图片路径
    //     label1: "\"公益捐步\"属于公开募捐吗？",
    //     label2: "\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？"
    //   },
    //   {
    //     image: "/img/index/文章3.png", // 替换为实际图片路径
    //     label1: "\"公益捐步\"属于公开募捐吗？",
    //     label2: "\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？\"公益捐步\"属于公开募捐吗？"
    //   }
    // ];

    // 更新页面数据
    this.setData({
      items: res.data.list
    });
  },
  toPath(e){
    const path = e.currentTarget.dataset.path;
    if(path=="/pages/talk/consultyy/consultyy"){
      wx.switchTab({
        url: '/pages/talk/consultyy/consultyy' // 替换为实际要跳转的tabBar页面路径
      });
    }
    wx.navigateTo({
      url: path
    });
  },
  toSearch(){
    wx.navigateTo({
      url: '/pages/sousuo/sousuo',
    })
  },
  handleButtonClick(){
    wx.navigateTo({
      url: '/pages/index/tiwen/tiwen',
    })
  }

 

  





})
